from flask import Flask
from cache import cache
from views import jsdelivr_proxy, unpkg_proxy, google_fonts_proxy, main_view, cdnjs_proxy

def create_app():
    app = Flask(
        __name__,
        static_folder='app/dist/assets',
        template_folder='app/dist',
    )

    app.config.from_object('config')

    cache.init_app(app)

    app.register_blueprint(jsdelivr_proxy)
    app.register_blueprint(unpkg_proxy)
    app.register_blueprint(google_fonts_proxy)
    app.register_blueprint(cdnjs_proxy)
    app.register_blueprint(main_view)

    return app

if __name__ == '__main__':
    app = create_app()
    # Specify the port here
    app.run(debug=True, port=5001)
